#ifndef __TASK__HPP
#define __TASK__HPP

#include <iostream>
#include <vector>
#include <time.h>

typedef void (*task)();

void PrintTask()
{
    std::cout << "打印任务" << std::endl;
}
void DowlanTask()
{
    std::cout << "下载任务" << std::endl;
}
void ReadTask()
{
    std::cout << "读取任务" << std::endl;
}

class TaskManager
{
public:
    TaskManager()
    {
        srand(time(nullptr));
    }
    ~TaskManager()
    {
    }
    void Push(task t)
    {
        _vt.push_back(t);
    }

    int GetTaskCode()
    {
        std::cout << " 我获取了一个任务" << std::endl;
        return rand()% _vt.size();
    }

    void Extrue(int code)
    {
        std::cout << " 我正在执行一个任务, 任务码是 " << code << std::endl;
        _vt[code]();
    }

private:
    std::vector<task> _vt;
};

#endif